<!DOCTYPE html>
<html lang="en">
<!--
	作者：王懿宸
	时间：2019-05-29
	描述：用户登录进入
-->
	<head>
		<meta charset="UTF-8">
		<title>财务管理系统</title>
		<link rel="stylesheet" href="js/bower_components/bootstrap/dist/css/bootstrap.min.css">
		<script src="js/bower_components/jquery/dist/jquery.min.js"></script>
		<script src="js/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<script>
			$(function() {
				$("#btnLog").click(function() {
					var name = $("#txtAccount").val();
					var pwd = $("#txtPwd").val();
					//console.log(name);
					//alert("请输入账号和密码");
					/*
					 * 增加输入值的交验：
					 * 1.判断空值；
					 * 2.判断输入的值知否有效值；
					 * 3.是否需要增加注入的过滤；
					 * 4.输入值的长度；
					 */
					
					var str = '{"username":"' + name + '","pwd":"'+pwd+'"}';
					alert(str)
					$.ajax({
						type: "put",
						url: "http://127.0.0.1:8080/getUnameStr",
						data: Str,
						dataType:"json",
						contentType: "application/json;charset=utf-8", //重点，传输数据的类型及格式
						//data是接口返回的数据
						success: function(data) {
							co
							//返回接口成功后事件的处理
							if(data!="") {
								location.href = "html/index.html";
							}else{
								alert("您输入的用户名或密码不存在！")
							}
						},
						error:function(data){
							//访问接口出现错误的提示
							//alert(data);
						}
					});
				});
			});
		</script>

	</head>

	<body>
		<div class="container">
			<div class="row col-md-12">
				<div class="col-md-3"></div>
				<div class="col-md-6">
					<div class="panel panel-primary" style="margin-top: 150px;">
						<div class="panel-heading"><strong>系统登录</strong></div>
						<div class="panel-body">
							<div class="input-group">
								<span class="input-group-addon" id="basic-addon1">
                                <span class="glyphicon glyphicon-user"></span>
								</span>
								<input id="txtUserName" type="text" class="form-control" placeholder="账户">
							</div>
							<br />
							<div class="input-group">
								<span class="input-group-addon" id="basic-addon2">
                                <span class="glyphicon glyphicon-lock"></span>
								</span>
								<input id="txtPwd" type="password" class="form-control" placeholder="密码">
							</div>
							<br />
							<div class="input-group">
								<span class="input-group-addon" id="basic-addon3">
                                <span class="glyphicon glyphicon-adjust"></span>
								</span>
								<input id="txtYan" type="text" class="form-control" style="width:120px;" placeholder="验证码">
							</div>
							<br />
							<div class="btn-group-lg text-right">
								<button id="btnLog" type="button" class="btn btn-success">登录</button>

							</div>
						</div>
					</div>
				</div>
				<div class="col-md-3"></div>
			</div>
		</div>
	</body>

</html>